package com.captainbank.tcl.tclapplication.ui.adapter;

import android.content.Context;
import android.view.View;

import com.captainbank.tcl.tclapplication.R;
import com.captainbank.tcl.tclapplication.model.Banner;
import com.captainbank.tcl.tclapplication.ui.views.RatioRoundImageView;
import com.captainbank.tcl.tclapplication.utils.MyToast;
import com.captainbank.tcl.tclapplication.utils.glide.GlideLoader;
import com.wenjian.loopbanner.LoopAdapter;

import java.util.List;

/**
 * Created by TCL on 2019/6/28.
 * Describe:
 */
public class LoopBannerAdapter extends LoopAdapter<Banner> {
    private Context mContext;

    public LoopBannerAdapter(Context context, List<Banner> data, int layoutId) {
        super(data, layoutId);
        mContext = context;
    }

    @Override
    protected void onBindView(final ViewHolder holder, Banner data, final int position) {
        RatioRoundImageView riv = holder.getView(R.id.riv_banner);
        GlideLoader.getInstance().initLoadImage(holder.getContext(),data.getImageUrl(),riv,GlideLoader.LoadOption.LOAD_BANNER);
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MyToast.toastNormal(holder.getContext(),"点击了："+ position);
            }
        });
    }
}
